package main

import (
	"fmt"
	"time"
)

func SelectTimeout() {
	ch1 := make(chan string)

	go func() {
		time.Sleep(5 * time.Second)
		ch1 <- "put value into ch1"
	}()

	select {
	case va1 := <-ch1:
		fmt.Println("recv value from ch1:", va1)
		return
	case <-time.After(3 * time.Second):
		fmt.Println("3 second over,time out")
	}
}

func main() {
	SelectTimeout()
}
